package com.kkb.kkbauth.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 天选ywy
 * @title: Role
 * @projectName kkb-parent-v2
 * @description: 角色实体类
 * @date 2021/8/14
 */

@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Role对象")
@Accessors(chain = true)
public class Role implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "role主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "角色名称")
    @TableField("name")
    @NotNull(message = "角色名称不能为空")
    private String name;

    @ApiModelProperty(value = "角色描述")
    private String roleDescription;

    @ApiModelProperty(value = "0:未删除 1:已删除")
    @TableField("is_deleted")
    private Integer deleted;

    @ApiModelProperty(value = "起始时间")
    @TableField(exist = false)
    @Transient
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "截止时间")
    @TableField(exist = false)
    @Transient
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "权限id")
    @TableField(exist = false)
    private Long[] permissionId;
}

